package com.securecrt.pojo;

import java.util.List;

import com.securecrt.R;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class SaveSessionAdapter extends BaseAdapter implements OnClickListener {

	private Context context;
	private List<Savesession> listAdapte;
	public SaveSessionAdapter(Context context,List<Savesession> listAdapte){
		this.context=context;
		this.listAdapte=listAdapte;
	}
	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return listAdapte.size();
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return listAdapte.get(position);
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		Savesession entry=listAdapte.get(position);
		if(convertView==null){
			LayoutInflater inflater=(LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
			convertView=inflater.inflate(R.layout.rowadapter, null);
		}
		TextView tvItemList=(TextView)convertView.findViewById(R.id.tvItemList);
		tvItemList.setText(entry.getId()+" : "+entry.getHostname()+"@"+entry.getUsername()+" : "+entry.getPort());
		tvItemList.setTextSize(16);
		return convertView;
	}
	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		
	}

}
